import myAxios from "@/request";
import type {
  DormitoryExpenseBillQueryRequest,
  DormitoryExpenseBillAddRequest,
  DormitoryExpenseBillUpdateRequest,
} from "@/models/dormitoryExpenseBill";

/**
 * 分页获取宿舍水电支出列表
 */
export function listDormitoryExpenseBillByPage(
  dormitoryExpenseBillQueryRequest: DormitoryExpenseBillQueryRequest
) {
  return myAxios.request({
    url: "/api/dormitoryExpenseBill/list/page",
    method: "post",
    data: dormitoryExpenseBillQueryRequest,
  });
}

/**
 * 添加宿舍水电支出
 */
export function addDormitoryExpenseBill(
  dormitoryExpenseBillAddRequest: DormitoryExpenseBillAddRequest
) {
  return myAxios.request({
    url: "/api/dormitoryExpenseBill/add",
    method: "post",
    data: dormitoryExpenseBillAddRequest,
  });
}

/**
 * 更新宿舍水电支出
 */
export function updateDormitoryExpenseBill(
  dormitoryExpenseBillUpdateRequest: DormitoryExpenseBillUpdateRequest
) {
  return myAxios.request({
    url: "/api/dormitoryExpenseBill/update",
    method: "post",
    data: dormitoryExpenseBillUpdateRequest,
  });
}

/**
 * 删除宿舍水电支出
 */
export function deleteDormitoryExpenseBill(id: number) {
  return myAxios.request({
    url: "/api/dormitoryExpenseBill/delete",
    method: "post",
    data: { id },
  });
}

/**
 * 获取最近账单
 */
export function getRecentBill() {
  return myAxios.request({
    url: "/api/dormitoryExpenseBill/getRecentBill",
    method: "get",
  });
}
